namespace CSharpTestDemo._1027;

public class Student
{
    private int id;//字段私有化 field 首字母小写
    private string name;
    private int age;

    public int Age
    {
        get => age;
        set => age = value;
    }

    public int Id    //公共属性 property 首字母大写
    {
        get => id;
        set => id = value;
    }

    public string Name
    {
        get => name;
        set => name = value ?? throw new ArgumentNullException(nameof(value));
    }

    public void Study()
    {
        Console.WriteLine($"{Name}正在学习");
    }
}